<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Naming Conventions | Rho Framework Docs</title>
<meta name="description" value="Naming Conventions - Documentation for the Rho PHP Framework" />
<meta name="keywords" value="rho, framework, php, docs, documentation, help, examples" />
<link href="docs.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" />
</head>
<body>
<!-- header -->
<div id="byline">ρ Rho Framework Documentation</div>
<h1>Naming Conventions</h1>

<h2>File Names</h2>

<p><strong>Must</strong> be ASCI, no symbols except underscore, no spaces.</p>

<p>Usually lowercase (but must not be).</p>

<p>Models, views and controllers end with <span class="file">.php</span>.
(though views may have different extension if you use a template engine)</p>

<p>Configuration files are stored in <span class="file">app/conf/</span>
 end with <span class="file">.php</span>, named after the module they configure,
 all lowercase. 
 <br />E.g. <span class="file">core.php</span> </p>

<p>Translation files are stored in <span class="file">app/i18n/</span>
 end with <span class="file">.php</span>, named after the section they provide language strings for,
 all lowercase.
 <br /> E.g. <span class="file">forms.php</span> </p>




<h3>Rho's Filename Conventions</h3>

<p>For files containing a single class definition, these are named after the class,
and end with <span class="file">.class.php</span>.
<br />E.g. <span class="file">Rho_Log.class.php</span></p>

<p>For files containing a multiple class definition, these are named after the functionality provided,
and end with <span class="file">.inc.php</span>.
<br />E.g. <span class="file">core.inc.php</span>.</p>


 
<h2>Class Naming</h2>

<p>Classes are named with the first letter of each word in uppercase, words seperated with a underscore, usual singular.
<br /> E.g. <code>Rho_Form</code></p>

<p>Controllers <strong>must</strong> end with <code>_Controller</code>.
<br />E.g. <code>class Widgets_Controller extends HTML_Controller</code></p>

<p>Model class names should end with <code>_Model</code> but this is not enforced.</p>

<p>Method names are in camelCase, e.g. <code>methodDoFoo()</code>.</p>

<p>Constants are all uppercase, with an underscore between words.</p>

<p>Properties are lowercase, with an underscore between words.</p>

<p>Private methods and private properties start with an underscore.
 <br />E.g. <code>private function _methodDoBar()</code>.</p>

<div class="next"><a href="config.html">Configuration Files &gt;&gt;</a></div>

<div id="footer"><p><a href="index.html">Contents</a></p>
<a href="http://code.google.com/p/rho/">Rho Framework Home</a></div>

</body>
</html>